// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.ooops;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class FieldsToVariablesClass {
  int sum;

  @FieldsToVariables
  public int add(int a, int b) {
    sum = 0;
    while (a-- != 0) sum++;
    while (b-- != 0) sum++;
    return sum;
  }
  
  public static void main(String[] args) {
    FieldsToVariablesClass test = new FieldsToVariablesClass();
    long time = System.currentTimeMillis();
    int sum = test.add(100000000, 1000000000);
    System.out.println("Time elapsed: " + (System.currentTimeMillis() - time) + "ms");
    System.out.println("Result: " + sum);
    
    time = System.currentTimeMillis();
    sum = test.add(100000000, 1000000000);
    System.out.println("Time elapsed: " + (System.currentTimeMillis() - time) + "ms");
    System.out.println("Result: " + sum);
  }
}
